package com.itjavas.cslp2.controller;

import com.itjavas.cslp2.pojo.entity.Comment;
import com.itjavas.cslp2.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/comment")
public class CommentController {
    @Autowired
    CommentService commentService;
    //添加新评论
    @RequestMapping("/addComment")
    public ResponseEntity<Boolean> addComment(@RequestBody Comment comment){
        return commentService.addComment(comment);
    }

    //删除评论
    @RequestMapping("/deleteComment")
    public ResponseEntity<Boolean> deleteComment(@RequestParam String id){
        return commentService.deleteComment(id);
    }
}
